package com.qingmi.farmer.data.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
 * 商品
 */
public class GoodsInfo implements Parcelable {

    //商品Id
    @SerializedName("GoodId")
    private String goodId;

    //名称
    @SerializedName("Name")
    private String name;

    //照片 1张
    @SerializedName("Pic")
    private String pic;

    //多张照片
    @SerializedName("Pics")
    private List<String> pics;

    //价格 保留2位小数
    @SerializedName("Price")
    private double price;

    //非合作社单价
    @SerializedName("NoCPrice")
    private double noCPrice;

    @SerializedName("Freight")
    private double freight;

    //单位
    @SerializedName("Unit")
    private String unit;

    //厂家名称
    @SerializedName("Vendor")
    private String vendor;

    //描述, 图文详情html
    @SerializedName("Desc")
    private String desc;

    @SerializedName("DescUrl")
    private String descUrl;

    //销量
    @SerializedName("Sales")
    private int sales;

    //剩余数量
    @SerializedName("Amount")
    private int amount;

    //推荐简介
    @SerializedName("RecommendSummary")
    private String recommendSummary;

    //规格参数
    @SerializedName("SpecificationPara")
    private String specificationPara;

    //规格参数
    @SerializedName("SpecificationParaJson")
    private List<Param> specificationParaJson;

    //供应商
    @SerializedName("Supplier")
    private Supplier supplier;

    //所属管局信息
    @SerializedName("SuperviseName")
    private String superviseName;

    public GoodsInfo() {
    }


    protected GoodsInfo(Parcel in) {
        goodId = in.readString();
        name = in.readString();
        pic = in.readString();
        pics = in.createStringArrayList();
        price = in.readDouble();
        noCPrice = in.readDouble();
        freight = in.readDouble();
        unit = in.readString();
        vendor = in.readString();
        desc = in.readString();
        descUrl = in.readString();
        sales = in.readInt();
        amount = in.readInt();
        recommendSummary = in.readString();
        specificationPara = in.readString();
        specificationParaJson = in.createTypedArrayList(Param.CREATOR);
        supplier = in.readParcelable(Supplier.class.getClassLoader());
        superviseName = in.readString();
    }

    public static final Creator<GoodsInfo> CREATOR = new Creator<GoodsInfo>() {
        @Override
        public GoodsInfo createFromParcel(Parcel in) {
            return new GoodsInfo(in);
        }

        @Override
        public GoodsInfo[] newArray(int size) {
            return new GoodsInfo[size];
        }
    };

    public String getSuperviseName() {
        return superviseName;
    }

    public void setSuperviseName(String superviseName) {
        this.superviseName = superviseName;
    }

    public double getFreight() {
        return freight;
    }

    public void setFreight(double freight) {
        this.freight = freight;
    }

    public String getRecommendSummary() {
        return recommendSummary;
    }

    public void setRecommendSummary(String recommendSummary) {
        this.recommendSummary = recommendSummary;
    }

    public String getGoodId() {
        return goodId;
    }

    public void setGoodId(String goodId) {
        this.goodId = goodId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public List<String> getPics() {
        return pics;
    }

    public void setPics(List<String> pics) {
        this.pics = pics;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getNoCPrice() {
        return noCPrice;
    }

    public void setNoCPrice(double noCPrice) {
        this.noCPrice = noCPrice;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getVendor() {
        return vendor;
    }

    public void setVendor(String vendor) {
        this.vendor = vendor;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getSales() {
        return sales;
    }

    public void setSales(int sales) {
        this.sales = sales;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public String getSpecificationPara() {
        return specificationPara;
    }

    public void setSpecificationPara(String specificationPara) {
        this.specificationPara = specificationPara;
    }

    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    public List<Param> getSpecificationParaJson() {
        return specificationParaJson;
    }

    public void setSpecificationParaJson(List<Param> specificationParaJson) {
        this.specificationParaJson = specificationParaJson;
    }

    public String getDescUrl() {
        return descUrl;
    }

    public void setDescUrl(String descUrl) {
        this.descUrl = descUrl;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(goodId);
        dest.writeString(name);
        dest.writeString(pic);
        dest.writeStringList(pics);
        dest.writeDouble(price);
        dest.writeDouble(noCPrice);
        dest.writeDouble(freight);
        dest.writeString(unit);
        dest.writeString(vendor);
        dest.writeString(desc);
        dest.writeString(descUrl);
        dest.writeInt(sales);
        dest.writeInt(amount);
        dest.writeString(recommendSummary);
        dest.writeString(specificationPara);
        dest.writeTypedList(specificationParaJson);
        dest.writeParcelable(supplier, flags);
        dest.writeString(superviseName);
    }
}
